<?php

class Kd_Aop {

//    private static $_proxies = array();

    public function autoload($className){
        $subPath = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $className))).'.php';
//        if(!in_array($className, self::$_proxies)){
//            if(Kd_Aop_Manager::isPointcutin($className)){
//                if(!file_exists(Kd_Aop_Manager::getCompiledPath().$subPath)){
//                    Kd_Aop_Compiler::compile();
//                    self::$_proxies[$className];
//                }
//            }
//        }
        return include_once $subPath;
    }

    static public function register(){
        spl_autoload_register(array(self::getInstance(), 'autoload'));
    }

    static private $_instance = NULL;
    static public function getInstance(){
        if(!self::$_instance){
            self::$_instance = new self();
        }
        return self::$_instance;
    }
}

